<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>退款页面</title>
    <link href="css/bootstrap.css" rel="stylesheet">
    <link href="fonts/glyphicons-halflings-regular.woff2">
</head>
<body>
<div id="top"></div>
<div class="container" style="margin-top: 5%;margin-left: 20%">
    <h1>退款信息表</h1>

    <div class="form-group">
<!--        <label>商品名称:</label>-->
<!--        <input type="text" id="name"><br><br><br>-->
<!--        <label >退款金额:</label>-->
<!--        <input type="text" id="refundCount" ><br><br><br>-->
        <label for="reason">退款原因:</label><textarea id="reason" class="form-control" rows="3"></textarea>
    </div><br><br>
    <button id="submit" type="button" class="btn btn-primary">提交</button>
</div>

<script type="text/javascript" src="js/jquery-3.6.4.js"></script>
<script src="js/bootstrap.min.js"></script>
<script type="text/javascript">
    $(function (){
        $("#top").load("top.html")
        //接收传过来的iid 并发送ajax请求
        const searchParams = new URLSearchParams(location.search);
        const iid = searchParams.get("iid");
        //退款状态->1
        //提交点击事件
        $("#submit").click(function (){
            //获取退款原因
            let reason=$("#reason").val()
            $.ajax({
                url:"/PDD/order?method=addRefund",
                data:{
                    "iid":iid,
                    "reason":reason,
                    "state":1
                },
                dataType:"json",
                type:"post",
                success:function (data){
                    if(data.code===1){
                        alert("退款申请提交成功,请等待商家审批")
                        window.history.back()
                    }
                }
            })
        })
    })
</script>
</body>
</html>